//
//  QSWaitingForProcessedCell.m
//  DigitalEconomy_iOS
//
//  Created by Ding on 2020/3/22.
//  Copyright © 2020 DingC. All rights reserved.
//

#import "QSWaitingForProcessedCell.h"

@implementation QSWaitingForProcessedCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self configSubView];
}

- (void)configSubView{
    self.stateLabel.layer.cornerRadius = 2;
    self.stateLabel.layer.masksToBounds = YES;
    self.backgroundColor = [UIColor clearColor];
    self.contentView.layer.cornerRadius = 8;
    self.contentView.layer.masksToBounds = YES;
    self.contentView.backgroundColor = [UIColor QSColorWhiteFFFFFF];
    [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.mas_leading).offset(kRealValue(10));
        make.trailing.equalTo(self.mas_trailing).offset(kRealValue(-10));
        make.top.equalTo(self.mas_top).offset(kRealValue(10));
        make.bottom.equalTo(self.mas_bottom).offset(kRealValue(0));
    }];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(QSProblemReportModel *)model{
    _model = model;
    self.companyNameLabel.text = model.companyName;
    self.detailLabel.text = model.title;
    self.stateLabel.text = model.stateStr;
    self.otherlabel.text = model.typeName;
    if (model.state.intValue == 4) {
        //已办结
        self.stateLabel.textColor = [UIColor colorWithHexString:@"#27BA85"];
        self.stateLabel.backgroundColor = [UIColor colorWithRed:196.0f / 255.0f  green:234.0f / 255.0f blue:220.0f / 255.0f alpha:1];
        self.dateLabel.text = [NSString stringWithFormat:@"办结时间：%@", [NSDate dateWithTimestamp:model.dealTime format:@"yyyy-MM-dd HH:mm"]];
    }else{
        if(model.state.integerValue == 1){
            //待处理
            self.stateLabel.backgroundColor = [UIColor colorWithHexString:@"#FFEDE9"];
            self.stateLabel.textColor = [UIColor colorWithHexString:@"#FF5224"];
        }else if (model.state.integerValue == 2){
            //处理中
            self.stateLabel.textColor = [UIColor colorWithHexString:@"#FC9F28"];
            self.stateLabel.backgroundColor = [UIColor colorWithHexString:@"#FFF5E9"];
        }else{
            //不受理
            self.stateLabel.backgroundColor = [UIColor QSColorGrayF5F5F5];
            self.stateLabel.textColor = [UIColor colorWithHexString:@"#999999"];
        }
        self.dateLabel.text = [NSString stringWithFormat:@"提交时间：%@", [NSDate dateWithTimestamp:model.createTime format:@"yyyy-MM-dd HH:mm"]];
    }
}

- (void)setDealingModel:(QSProblemDeaingModel *)dealingModel{
    _dealingModel = dealingModel;
    self.companyNameLabel.text = dealingModel.companyName;
    self.detailLabel.text = dealingModel.title;
    self.stateLabel.text = dealingModel.stateStr;
    self.otherlabel.text = dealingModel.typeName;
    if (dealingModel.state.intValue == 4) {
        //已办结
        self.stateLabel.textColor = [UIColor colorWithHexString:@"#27BA85"];
        self.dateLabel.text = [NSString stringWithFormat:@"办结时间：%@", [NSDate dateWithTimestamp:dealingModel.dealTime format:@"yyyy-MM-dd HH:mm"]];
    }else{
        if(dealingModel.state.integerValue == 1){
            //待处理
            self.stateLabel.textColor = [UIColor colorWithHexString:@"#FF5224"];
        }else if (dealingModel.state.integerValue == 2){
            //处理中
            self.stateLabel.textColor = [UIColor colorWithHexString:@"#FC9F28"];
        }else{
            //不受理
            self.stateLabel.textColor = [UIColor colorWithHexString:@"#999999"];
        }
        self.dateLabel.text = [NSString stringWithFormat:@"提交时间：%@", [NSDate dateWithTimestamp:dealingModel.createTime format:@"yyyy-MM-dd HH:mm"]];
    }
}

@end
